Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Added new VM commands #261

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vikramarsid
Copy link

@vikramarsid vikramarsid commented Nov 15, 2018

Added more VM commands supported by pyvcloud.
Included minor code corrections.
List of new commands added are:

  • list (implemented existing noob function)
  vcd vm list build-vms
  property    value
  ----------  -----------------------------------------------------------------------------------------------------
  vm_list     [
                  {
                      "needsCustomization": "true",
                      "nestedHypervisorEnabled": "false",
                      "deployed": "true",
                      "status": "4",
                      "name": "build-02-500",
                      "id": "urn:vcloud:vm:6f097e46-1a6c-4e4b-b9dc-c6553fd12461",
                      "href": "https://vcloud.com/api/vApp/vm-6f097e46-1a6c-4e4b-b9dc-c6553fd12461",
                      "description": null,
                      "date_created": "2018-10-23T20:41:25.007-04:00"
                  },
                  {
                      "needsCustomization": "true",
                      "deployed": "true",
                      "status": "8",
                      "name": "build-03-422",
                      "id": "urn:vcloud:vm:c0b41700-db51-4780-8396-827b1e7b8f6b",
                      "href": "https://vcloud.com/api/vApp/vm-c0b41700-db51-4780-8396-827b1e7b8f6b",
                      "date_created": "2018-11-14T16:57:03.433-05:00"
                  },
                  {
                      "needsCustomization": "true",
                      "deployed": "true",
                      "status": "4",
                      "name": "build-01-422",
                      "id": "urn:vcloud:vm:89f09dcc-4fdf-46f9-b917-5303cd1b3204",
                      "href": "https://vcloud.com/api/vApp/vm-89f09dcc-4fdf-46f9-b917-5303cd1b3204",
                      "description": "Build VM",
                      "date_created": "2018-10-15T11:53:25.267-04:00"
                  }
              ]
  • power-on
  vcd vm power-on build-vms build-03-422
  Powering on the virtual machine
  property     value
  -----------  ---------------------------------------------------------------------------------------------------
  vm_power_on  {
                   "cancelRequested": "false",
                   "expiryTime": "2019-02-13T10:17:06.241-05:00",
                   "operation": "Starting Virtual Machine build-03-422(c0b41700-db51-4780-8396-827b1e7b8f6b)",
                   "operationName": "vappDeploy",
                   "serviceNamespace": "com.vmware.vcloud",
                   "startTime": "2018-11-15T10:17:06.241-05:00",
                   "status": "queued",
                   "name": "task",
                   "id": "urn:vcloud:task:0189d9b7-f24d-4d48-bc40-6c54e079c5a6",
                   "href": "https://vcloud.com/api/task/0189d9b7-f24d-4d48-bc40-6c54e079c5a6",
                   "type": "application/vnd.vmware.vcloud.task+xml"
               }
  • power-off
vcd vm power-off build-vms build-03-422
Powering off the virtual machine
property      value
------------  -------------------------------------------------------------------------------------------------------
vm_power_off  {
                  "cancelRequested": "false",
                  "expiryTime": "2019-02-13T10:18:57.353-05:00",
                  "operation": "Powering Off Virtual Machine build-03-422(c0b41700-db51-4780-8396-827b1e7b8f6b)",
                  "operationName": "vappPowerOff",
                  "serviceNamespace": "com.vmware.vcloud",
                  "startTime": "2018-11-15T10:18:57.353-05:00",
                  "status": "queued",
                  "name": "task",
                  "id": "urn:vcloud:task:aeeae89f-e794-4be7-94ce-ec0722bb5bd7",
                  "href": "https://vcloud.com/api/task/aeeae89f-e794-4be7-94ce-ec0722bb5bd7",
                  "type": "application/vnd.vmware.vcloud.task+xml"
              }
  • power-reset
vcd vm power-reset build-vms build-03-422
Resetting the virtual machine
property        value
--------------  ----------------------------------------------------------------------------------------------------
vm_power_reset  {
                    "cancelRequested": "false",
                    "expiryTime": "2019-02-13T10:21:29.572-05:00",
                    "operation": "Resetting Virtual Machine build-03-422(c0b41700-db51-4780-8396-827b1e7b8f6b)",
                    "operationName": "vappReset",
                    "serviceNamespace": "com.vmware.vcloud",
                    "startTime": "2018-11-15T10:21:29.572-05:00",
                    "status": "queued",
                    "name": "task",
                    "id": "urn:vcloud:task:84ca6d65-337b-4ac8-a78d-8351ced97dbe",
                    "href": "https://vcloud.com/api/task/84ca6d65-337b-4ac8-a78d-8351ced97dbe",
                    "type": "application/vnd.vmware.vcloud.task+xml"
                }
  • reboot
vcd vm reboot build-vms build-03-422
Rebooting on the virtual machine
property    value
----------  ----------------------------------------------------------------------------------------------------
vm_reboot   {
                "cancelRequested": "false",
                "expiryTime": "2019-02-13T10:23:29.278-05:00",
                "operation": "Rebooting Virtual Machine build-03-422(c0b41700-db51-4780-8396-827b1e7b8f6b)",
                "operationName": "vappRebootGuest",
                "serviceNamespace": "com.vmware.vcloud",
                "startTime": "2018-11-15T10:23:29.278-05:00",
                "status": "queued",
                "name": "task",
                "id": "urn:vcloud:task:951eda22-f6df-47d4-8b4b-b13059e06e7c",
                "href": "https://vcloud.com/api/task/951eda22-f6df-47d4-8b4b-b13059e06e7c",
                "type": "application/vnd.vmware.vcloud.task+xml"
            }
  • shutdown
vcd vm shutdown build-vms build-03-422
Shutting down on the virtual machine
property     value
-----------  --------------------------------------------------------------------------------------------------------
vm_shutdown  {
                 "cancelRequested": "false",
                 "expiryTime": "2019-02-13T10:25:06.431-05:00",
                 "operation": "Shutting down Virtual Machine build-03-422(c0b41700-db51-4780-8396-827b1e7b8f6b)",
                 "operationName": "vappShutdownGuest",
                 "serviceNamespace": "com.vmware.vcloud",
                 "startTime": "2018-11-15T10:25:06.431-05:00",
                 "status": "queued",
                 "name": "task",
                 "id": "urn:vcloud:task:d8449128-7aa3-4352-b1a5-536d8a5f4486",
                 "href": "https://vcloud.com/api/task/d8449128-7aa3-4352-b1a5-536d8a5f4486",
                 "type": "application/vnd.vmware.vcloud.task+xml"
             }
  • show-snapshot
vcd vm show-snapshot build-vms build-03-422
property     value
-----------  ---------------------------------------------------
vm_snapshot  [
                 {
                     "created": "2018-11-14T17:49:23.547-05:00",
                     "poweredOn": "true",
                     "size": "236223201280"
                 }
             ]
  • create-snapshot
vcd vm create-snapshot build-vms build-03-422
Creating snapshot for the virtual machine
property            value
------------------  ------------------------------------------------------------------------------------------------------------
vm_create_snapshot  {
                        "cancelRequested": "false",
                        "expiryTime": "2019-02-13T10:27:24.860-05:00",
                        "operation": "Creating Snapshot Virtual Machine build-03-422(c0b41700-db51-4780-8396-827b1e7b8f6b)",
                        "operationName": "vappCreateSnapshot",
                        "serviceNamespace": "com.vmware.vcloud",
                        "startTime": "2018-11-15T10:27:24.860-05:00",
                        "status": "queued",
                        "name": "task",
                        "id": "urn:vcloud:task:394e4bf2-4e88-4ea7-b38c-46a82a27914d",
                        "href": "https://vcloud.com/api/task/394e4bf2-4e88-4ea7-b38c-46a82a27914d",
                        "type": "application/vnd.vmware.vcloud.task+xml"
                    }
  • revert-snapshot
vcd vm revert-snapshot build-vms build-03-422
Reverting to the latest snapshot of the virtual machine
property            value
------------------  ----------------------------------------------------------------------------------------------------------------
vm_snapshot_revert  {
                        "cancelRequested": "false",
                        "expiryTime": "2019-02-13T10:28:36.115-05:00",
                        "operation": "Reverting to Snapshot Virtual Machine build-03-422(c0b41700-db51-4780-8396-827b1e7b8f6b)",
                        "operationName": "vappRevertToCurrentSnapshot",
                        "serviceNamespace": "com.vmware.vcloud",
                        "startTime": "2018-11-15T10:28:36.115-05:00",
                        "status": "queued",
                        "name": "task",
                        "id": "urn:vcloud:task:1e287908-1e2b-43bc-900b-1db88ade5a63",
                        "href": "https://vcloud.com/api/task/1e287908-1e2b-43bc-900b-1db88ade5a63",
                        "type": "application/vnd.vmware.vcloud.task+xml"
                    }
  • remove-snapshot
vcd vm remove-snapshot build-vms build-03-422
Removing all snapshots of the virtual machine
property            value
------------------  ------------------------------------------------------------------------------------------------------------
vm_snapshot_remove  {
                        "cancelRequested": "false",
                        "expiryTime": "2019-02-13T10:29:26.141-05:00",
                        "operation": "Removing Snapshot Virtual Machine build-03-422(c0b41700-db51-4780-8396-827b1e7b8f6b)",
                        "operationName": "vappRemoveAllSnapshots",
                        "serviceNamespace": "com.vmware.vcloud",
                        "startTime": "2018-11-15T10:29:26.141-05:00",
                        "status": "queued",
                        "name": "task",
                        "id": "urn:vcloud:task:6abfcb65-9a68-469e-a26d-81716166a4c8",
                        "href": "https://vcloud.com/api/task/6abfcb65-9a68-469e-a26d-81716166a4c8",
                        "type": "application/vnd.vmware.vcloud.task+xml"
                    }

Added more VM commands supported by pyvcloud.
Included minor code corrections.
List of new commands added are:
- list (implemented existing noob function)
- power-on
- power-off
- power-reset
- reboot
- shutdown
- show-snapshot
- create-snapshot
- revert-snapshot
- remove-snapshot
@vikramarsid
Copy link
Author

@hodgesrm Can you merge/review this PR ? Let me know if any changes are required.

@3nodedev
Copy link

Is there a reason this PR hasn't been merged? It is providing some great functionality that would be much appreciated like snapshots. If it cannot be merged as is can we somehow get some of this functionality in?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants